package xaj.scc.ast;

import java.util.List;

import polyglot.ast.ClassBody;
import polyglot.ast.ClassMember;
import polyglot.ast.DelFactory;
import polyglot.ast.ExtFactory;
import polyglot.ast.TypeNode;
import polyglot.ast.Import.Kind;
import polyglot.types.Flags;
import polyglot.util.Position;
import abc.aspectj.ast.AJNodeFactory_c;
import abc.weaving.aspectinfo.AbcClass;

public class SCNodeFactory_c extends AJNodeFactory_c implements SCNodeFactory {

	private final SCExtFactory extFactory;
	private final SCDelFactory delFactory;
	
	public SCNodeFactory_c() {
		this(new SCAbstractExtFactory_c() {},
				new SCAbstractDelFactory_c() {});
	}
	
	public SCNodeFactory_c(SCExtFactory extFactory) {
		this(extFactory, new SCAbstractDelFactory_c() {});
	}
	
	public SCNodeFactory_c(SCExtFactory extFactory,
			SCDelFactory delFactory) {
		super(extFactory, delFactory);
		this.extFactory = extFactory;
		this.delFactory = delFactory;
	}


	protected ExtFactory extFactory() {
		return extFactory;
	}
	
	protected DelFactory delFactory() {
		return delFactory;
	}
	

	public xaj.scc.ast.ClosureFactor ClosureFactor(Position pos, Factor factor) {
		ClosureFactor n = new ClosureFactor_c(pos, factor);
		n = (ClosureFactor)n.ext(((SCExtFactory)extFactory()).extClosureFactor());
        n = (ClosureFactor)n.del(((SCDelFactory)delFactory()).delClosureFactor());
		return n;
	}

	public xaj.scc.ast.NamedFactor NamedFactor(Position pos, String name,
			Factor factor) {
		NamedFactor n = new NamedFactor_c(pos, name, factor);
		n = (NamedFactor)n.ext(((SCExtFactory)extFactory()).extNamedFactor());
        n = (NamedFactor)n.del(((SCDelFactory)delFactory()).delNamedFactor());
		return n;
	}

	public xaj.scc.ast.NumberOfPasses NumberOfPasses(Position pos, int number) {
		NumberOfPasses n = new NumberOfPasses_c(pos, number);
		n = (NumberOfPasses)n.ext(((SCExtFactory)extFactory()).extNumberOfPasses());
        n = (NumberOfPasses)n.del(((SCDelFactory)delFactory()).delNumberOfPasses());
		return n;
	}

	public xaj.scc.ast.OptionalFactor OptionalFactor(Position pos, Factor factor) {
		OptionalFactor n = new OptionalFactor_c(pos, factor);
		n = (OptionalFactor)n.ext(((SCExtFactory)extFactory()).extOptionalFactor());
        n = (OptionalFactor)n.del(((SCDelFactory)delFactory()).delOptionalFactor());
		return n;
	}

	public xaj.scc.ast.OrFactor OrFactor(Position pos, Factor left, Factor right) {
		OrFactor n = new OrFactor_c(pos, left, right);
		n = (OrFactor)n.ext(((SCExtFactory)extFactory()).extOrFactor());
        n = (OrFactor)n.del(((SCDelFactory)delFactory()).delOrFactor());
		return n;
	}
	
	public xaj.scc.ast.ConcatFactor ConcatFactor(Position pos, Factor left,
			Factor right) {
		ConcatFactor n = new ConcatFactor_c(pos, left, right);
		n = (ConcatFactor)n.ext(((SCExtFactory)extFactory()).extConcatFactor());
        n = (ConcatFactor)n.del(((SCDelFactory)delFactory()).delConcatFactor());
		return n;
	}

	public xaj.scc.ast.Production Production(Position pos, String nonTerminal,
			List<xaj.scc.ast.ProductionElement> list) {
		Production n = new Production_c(pos, nonTerminal, list);
		n = (Production)n.ext(((SCExtFactory)extFactory()).extProduction());
        n = (Production)n.del(((SCDelFactory)delFactory()).delProduction());
		return n;
	}

	public xaj.scc.ast.ProductionElement ProductionElement(Position pos,
			Factor factor, xaj.scc.ast.SemanticAction action) {
		ProductionElement n = new ProductionElement_c(pos, factor, action);
		n = (ProductionElement)n.ext(((SCExtFactory)extFactory()).extProductionElement());
        n = (ProductionElement)n.del(((SCDelFactory)delFactory()).delProductionElement());
		return n;
	}

	public xaj.scc.ast.SemanticAction SemanticAction(Position pos,
			polyglot.ast.Block block) {
		SemanticAction n = new SemanticAction_c(pos, block);
		n = (SemanticAction)n.ext(((SCExtFactory)extFactory()).extSemanticAction());
        n = (SemanticAction)n.del(((SCDelFactory)delFactory()).delSemanticAction());
		return n;
	}

	public xaj.scc.ast.SimpleFactor SimpleFactor(Position pos, String value) {
		SimpleFactor n = new SimpleFactor_c(pos, value);
		n = (SimpleFactor)n.ext(((SCExtFactory)extFactory()).extSimpleFactor());
        n = (SimpleFactor)n.del(((SCDelFactory)delFactory()).delSimpleFactor());
		return n;
	}
	
	public xaj.scc.ast.LambdaFactor LambdaFactor(Position pos) {
		LambdaFactor n = new LambdaFactor_c(pos);
		n = (LambdaFactor)n.ext(((SCExtFactory)extFactory()).extLambdaFactor());
		n = (LambdaFactor)n.del(((SCDelFactory)delFactory()).delLambdaFactor());
		return n;
	}

	public xaj.scc.ast.StringFactor StringFactor(Position pos, String value) {
		StringFactor n = new StringFactor_c(pos, value);
		n = (StringFactor)n.ext(((SCExtFactory)extFactory()).extStringFactor());
        n = (StringFactor)n.del(((SCDelFactory)delFactory()).delStringFactor());
		return n;
	}

	public xaj.scc.ast.SyntaxClassBody SyntaxClassBody(Position pos,
			xaj.scc.ast.NumberOfPasses number, SyntaxDeclaration sd,
			List<ClassMember> classmembers) {
		SyntaxClassBody n = new SyntaxClassBody_c(pos, number, sd, classmembers);
		n = (SyntaxClassBody)n.ext(((SCExtFactory)extFactory()).extSyntaxClassBody());
        n = (SyntaxClassBody)n.del(((SCDelFactory)delFactory()).delSyntaxClassBody());
		return n;
	}
	
	public xaj.scc.ast.SyntaxClassBody SyntaxClassBody(Position pos,
			xaj.scc.ast.NumberOfPasses number, SyntaxDeclaration sd,
			OnWeaving ow, List<ClassMember> classmembers) {
		SyntaxClassBody n = new SyntaxClassBody_c(pos, number, sd, ow, classmembers);
		n = (SyntaxClassBody)n.ext(((SCExtFactory)extFactory()).extSyntaxClassBody());
        n = (SyntaxClassBody)n.del(((SCDelFactory)delFactory()).delSyntaxClassBody());
		return n;
	}

	public xaj.scc.ast.SyntaxClassDecl SyntaxClassDecl(Position pos,
			Flags flags, String name, TypeNode superClass, List interfaces,
			xaj.scc.ast.SyntaxClassBody body) {
		SyntaxClassDecl n = new SyntaxClassDecl_c(pos, flags, name, superClass, interfaces, body);
		n = (SyntaxClassDecl)n.ext(((SCExtFactory)extFactory()).extSyntaxClassDecl());
        n = (SyntaxClassDecl)n.del(((SCDelFactory)delFactory()).delSyntaxClassDecl());
		return n;
	}

	public xaj.scc.ast.SyntaxDeclarationInsertion SyntaxDeclarationInsertion(
			Position pos, List<String> using,
			List<xaj.scc.ast.Production> productions) {
		SyntaxDeclarationInsertion n = new SyntaxDeclarationInsertion_c(pos, using, productions);
		n = (SyntaxDeclarationInsertion)n.ext(((SCExtFactory)extFactory()).extSyntaxDeclarationInsertion());
        n = (SyntaxDeclarationInsertion)n.del(((SCDelFactory)delFactory()).delSyntaxDeclarationInsertion());
		return n;
	}

	public xaj.scc.ast.SyntaxDeclarationInsertion SyntaxDeclarationInsertion(
			Position pos, String nonTerminal, List<String> using,
			List<xaj.scc.ast.Production> productions) {
		SyntaxDeclarationInsertion n = new SyntaxDeclarationInsertion_c(pos, nonTerminal, using,
				productions);
		n = (SyntaxDeclarationInsertion)n.ext(((SCExtFactory)extFactory()).extSyntaxDeclarationInsertion());
        n = (SyntaxDeclarationInsertion)n.del(((SCDelFactory)delFactory()).delSyntaxDeclarationInsertion());
		return n;
	}

	public xaj.scc.ast.SyntaxDeclarationOverrides SyntaxDeclarationOverrides(
			Position pos, String name) {
		SyntaxDeclarationOverrides n = new SyntaxDeclarationOverrides_c(pos, name);
		n = (SyntaxDeclarationOverrides)n.ext(((SCExtFactory)extFactory()).extSyntaxDeclarationOverrides());
        n = (SyntaxDeclarationOverrides)n.del(((SCDelFactory)delFactory()).delSyntaxDeclarationOverrides());
		return n;
	}

	public xaj.scc.ast.ImportSymbol ImportSymbol(Position pos, Kind kind,
			String name) {
		ImportSymbol n = new ImportSymbol_c(pos, kind, name);
		n = (ImportSymbol)n.ext(((SCExtFactory)extFactory()).extImportSymbol());
        n = (ImportSymbol)n.del(((SCDelFactory)delFactory()).delImportSymbol());
		return n;
	}

	public xaj.scc.ast.ImportSyntax ImportSyntax(Position pos, Kind kind,
			String name) {
		ImportSyntax n = new ImportSyntax_c(pos, kind, name);
		n = (ImportSyntax)n.ext(((SCExtFactory)extFactory()).extImportSyntax());
        n = (ImportSyntax)n.del(((SCDelFactory)delFactory()).delImportSyntax());
		return n;
	}

	public xaj.scc.ast.OnWeaving OnWeaving(Position pos, String name,
			List<ClassMember> productions) {
		OnWeaving o = new OnWeaving_c(pos, name, productions);
		//o = (OnWeaving)o.ext(((SCExtFactory)extFactory()).extOnWeaving());
        //o = (OnWeaving)o.del(((SCDelFactory)delFactory()).delOnWeaving());
		return o;
	}

	/*public xaj.scc.ast.OnWeaving OnWeaving() {
		OnWeaving o = new OnWeaving_c();
		//o = (OnWeaving)o.ext(((SCExtFactory)extFactory()).extOnWeaving());
        //o = (OnWeaving)o.del(((SCDelFactory)delFactory()).delOnWeaving());
		return o;
	}*/

}
